//============================================================================
// Name        : StorageManagerTest.cpp
// Author      : dhonegger
// Version     :
// Copyright   : cmpe226
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include "../database-cmpe226/StorageManager/StorageManager.h"

using namespace std;

int main() {
	cout << "Test Storage Manager" << endl << endl; //prints Test Storage Manager

	StorageManager *sm = new StorageManager();
	sm->PrintSpaceMap(10, cout);
	Page *pgs[3];
	pgs[0] = sm->AllocatePage();
	pgs[0]->GetRecordLocation()->SetStudent(5, "test_last", "test_first", "42 TestWallaby Way", 42);
	cout << "FIRST PAGE OUT" << endl;
	sm->PrintStudent(*(pgs[0]));
	pgs[1] = sm->AllocatePage();
	pgs[1]->GetRecordLocation()->SetStudent(123, "lancelot", "sir", "RHM RoundTable", 17173);
	cout << "SECOND PAGE OUT" << endl;
	sm->PrintStudent(*(pgs[1]));
	pgs[2] = sm->AllocatePage();
	pgs[2]->GetRecordLocation()->SetStudent(*(pgs[1]->GetRecordLocation()->GetStudent()));
	cout << "THIRD PAGE OUT" << endl;
	sm->PrintStudent(*(pgs[2]));
	sm->DeallocatePage(*(pgs[1]));
	sm->PrintSpaceMap(10, cout);

	cout << endl << "Test done.  Press enter to exit...";

	string input;
	cin >> input;

	return 0;
}
